<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  {:token()}

  <!-- 分类名称  -->
  <div class="form-group">
    <label for="t-name" class="control-label col-xs-12 col-sm-2">{:__('Pnickname')}:</label>
    <div class="col-xs-12 col-sm-8">
      <input id="t-name" data-rule="required" class="form-control" name="row[nickname]" type="text"
        value="{$row['nickname']}">
    </div>
  </div>
  <!-- 邮箱 -->
  <div class="form-group">
    <label for="t-email" class="control-label col-xs-12 col-sm-2">{:__('Pemail')}:</label>
    <div class="col-xs-12 col-sm-8">
      <input id="t-email" data-rule="required" class="form-control" name="row[email]" type="text"
        value="{$row['email']}">
    </div>
  </div>
  <!-- 手机号 -->
  <div class="form-group">
    <label for="t-mobile" class="control-label col-xs-12 col-sm-2">{:__('Pmobile')}:</label>
    <div class="col-xs-12 col-sm-8">
      <input id="t-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text"
        value="{$row['mobile']}">
    </div>
  </div>
  <!-- 性别 -->
  <div class="form-group">
    <label for="c-gender" class="control-label col-xs-12 col-sm-2">{:__('Pgender')}:</label>
    <div class="col-xs-12 col-sm-8">
      {:build_select('row[gender]', $genderoption, $row['gender'], ['class'=>'form-control', 'required'=>''])}
    </div>
  </div>
  <!-- 认证状态 -->
  <div class="form-group">
    <label for="t-auth" class="control-label col-xs-12 col-sm-2">{:__('Pauth')}:</label>
    <div class="col-xs-12 col-sm-8">
      {:build_select('row[auth]', $authoption, $row['auth'], ['class'=>'form-control', 'required'=>''])}
    </div>
  </div>

  <!-- 金额 -->
  <div class="form-group">
    <label for="t-amount" class="control-label col-xs-12 col-sm-2">{:__('Pamount')}:</label>
    <div class="col-xs-12 col-sm-8">
      <input id="t-amount" data-rule="required" class="form-control" name="row[money]" type="text"
        value="{$row['money']}">
    </div>
  </div>
  <!-- 客户来源 -->
  <div class="form-group">
    <label for="t-source" class="control-label col-xs-12 col-sm-2">{:__('Psource')}:</label>
    <div class="col-xs-12 col-sm-8">
      {:build_select('row[sourceid]', $sourceoption, $row['source'], ['class'=>'form-control', 'required'=>''])}
    </div>
  </div>
  <!-- 成交状态 -->
  <div class="form-group">
    <label for="t-deal" class="control-label col-xs-12 col-sm-2">{:__('Pdeal')}:</label>
    <div class="col-xs-12 col-sm-8">
      {:build_select('row[deal]', $dealoption, $row['deal'], ['class'=>'form-control', 'required'=>''])}
    </div>
  </div>
  <!-- 地区选择 -->
  <div class="form-group">
    <label for="t-city" class="control-label col-xs-12 col-sm-2">{:__('Pcity')}:</label>
    <div class="col-xs-12 col-sm-8">
      <!-- <input id="c-city" class="form-control" data-toggle="city-picker" name="row[city]" type="text" value="" /> -->
      <div class='control-relative'>
        <input id="c-city" class="form-control" data-toggle="city-picker" name="row[city]" type="text"
          value="{$row['region_text2']}" />
      </div>
    </div>
  </div>
  <!-- <input class="qwe" type="text"> -->
  <!-- <input id="code" name="row[addresscode]" type="hidden" value=""> -->

  <div class="form-group layer-footer">
    <label class="control-label col-xs-12 col-sm-2"></label>
    <div class="col-xs-12 col-sm-8">
      <button id="btn_submit" type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
      <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
    </div>
  </div>
</form>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<!-- <script src="/public/assets/libs/fastadmin-citypicker/src/city-picker.data.js"></script>
<script src="/public/assets/libs/fastadmin-citypicker/src/city-picker.js"></script>
 -->
<script>
  /*    $(".qwe").on('input', function () {
         console.log('---------------');
     }); */

  /*  $("#c-city").on("cp:updated", function () {
       console.log('---------------');
       var citypicker = $(this).data("citypicker");
       var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
       $("#code").val(code);
   }); */
  $("#btn_submit").click(function () {
    var citypicker = $("#c-city").data("citypicker");
    // var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
    $("#c-city").val(citypicker.getCode("province") + '/' + citypicker.getCode("city") + '/' + citypicker.getCode("district"));

    // $("#code").val(citypicker.getCode("district")+'/'+ citypicker.getCode("city")+'/'+citypicker.getCode("province"));
  })
</script>